"""
MCP自定义异常

定义MCP相关的所有异常类型
"""


class MCPException(Exception):
    """MCP基础异常类"""
    def __init__(self, message: str, code: str = "MCP_ERROR"):
        self.message = message
        self.code = code
        super().__init__(self.message)


class MCPConnectionError(MCPException):
    """MCP连接错误"""
    def __init__(self, message: str):
        super().__init__(message, code="MCP_CONNECTION_ERROR")


class MCPTimeoutError(MCPException):
    """MCP超时错误"""
    def __init__(self, message: str):
        super().__init__(message, code="MCP_TIMEOUT_ERROR")


class MCPAuthenticationError(MCPException):
    """MCP认证错误"""
    def __init__(self, message: str):
        super().__init__(message, code="MCP_AUTHENTICATION_ERROR")


class MCPMessageError(MCPException):
    """MCP消息错误"""
    def __init__(self, message: str):
        super().__init__(message, code="MCP_MESSAGE_ERROR")

